Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to parse script from string #7

Merged
merged 4 commits into from
Jun 28, 2021

Conversation

popzxc
Copy link
Contributor

@popzxc popzxc commented Jun 27, 2021

According to discussion in rust-lang/rust-clippy#7400

r? @Manishearth

#[inline]
pub(crate) fn inner_from_short_name(input: &str) -> Option<Self> {
match input {
"" => Some(Script::Unknown),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this branch exist? Perhaps we should not return an Option and use Unknown as the catch all

Copy link
Contributor Author

@popzxc popzxc Jun 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Option may be helpful, because if some folk will accidentally use from_short_name instead of from_full_namethey'll get a None, which is easier to find early.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I'm not insisting, if you think that it's better to not use Option here, I'll be happy to change the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay returning an Option but we shouldn't have the empty branch imo

@Manishearth Manishearth merged commit b0cda40 into unicode-rs:master Jun 28, 2021
@popzxc popzxc deleted the parser-functions branch June 28, 2021 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants